import QtQuick 1.1
import com.nokia.meego 1.1

Page {
    id: tripPage
    //orientationLock : PageOrientation.LockPortrait
    property bool empty: tabGroup.currentTab.empty
    tools: commonTools

    function del()
    {
        tabGroup.currentTab.del()
    }
    function edit()
    {
        if (!tabGroup.currentTab.empty) {
            tabGroup.currentTab.edit()
        }
    }
    function add()
    {
        tabGroup.currentTab.add()
    }

    ButtonRow {
        id: my_tabs
        anchors {
            top: parent.top
            horizontalCenter: parent.horizontalCenter
        }
        style: TabButtonStyle { }
        TabButton {
            iconSource: "qrc:/icons/notes-inverse64.png"
            tab: tab1
        }
        TabButton {
            iconSource: "image://theme/icon-m-toolbar-people-white"
            tab: tab2
        }
    }
    TabGroup {
        id: tabGroup
        anchors {
            top: my_tabs.bottom
        }
        clip: true
        ExpensePage {
            id: tab1
            anchors.fill: parent
        }
        AccountPage {
            id: tab2
            anchors.fill: parent
        }
    }

    Label {
        text: tab2.empty ? "Start by adding an Account" : "Now add Expenses"
        visible: tab2.empty | tab1.empty
        anchors.centerIn: parent
        opacity: 0.3
    }

    Component.onCompleted: {
        tabGroup.currentTab = tab2.empty ? tab2 : tab1
    }
}

